import { computed, readonly, ref } from 'vue'

export type FilterType = 'area' | 'industry' | 'salary' | 'more'

export function useFiterType() {
	const filterType = ref<FilterType>('area')

	const setType = (type: FilterType) => {
		if (type === filterType.value) return

		filterType.value = type
	}

	return {
		filterType: readonly(filterType),
		isArea: computed(() => filterType.value === 'area'),
		isIndustry: computed(() => filterType.value === 'industry'),
		isSalary: computed(() => filterType.value === 'salary'),
		isMore: computed(() => filterType.value === 'more'),
		setType,
	}
}
